$:.unshift File.join(File.dirname(__FILE__),"..","lib")
require "test/unit"
require "find"
require "fileutils"
require "create_tree.rb"
require "file_deleter.rb"
require "filter_generator.rb"
require "pathname.rb"
class TestFileDeleter < Test::Unit::TestCase
  
  def setup
    @topdir = "topdir"   
    @checktime = "2008-12-30"
    
    @testdir = {@topdir =>[
      "a1",
      {"a2" => ["a2a1",
        {"a2a2" =>["a2a2a1","a2a2a2"]}  
        ]},
      {"a3" => ["a3a1","a3a2"]},
      {"a4" =>[]}
      ]}
    @fileseparator = File::SEPARATOR
    @dir = ".."+@fileseparator+@topdir+@fileseparator
    
    @fileDeleter = FileDeleter.new(@dir)
    CreateTree.new().create_tree(@testdir)  
    File.utime(Time.mktime(2008,1,1),Time.mktime(2008,12,1),@dir+"a1")
    File.utime(Time.mktime(2008,1,1),Time.mktime(2009,1,1),@dir+"a2")
    File.utime(Time.mktime(2008,1,1),Time.mktime(2008,12,1),@dir+"a2"+@fileseparator+"a2a1")
    File.utime(Time.mktime(2008,1,1),Time.mktime(2009,1,1),@dir+"a2"+@fileseparator+"a2a2")
    File.utime(Time.mktime(2008,1,1),Time.mktime(2009,1,1),@dir+"a2"+@fileseparator+"a2a2"+@fileseparator+"a2a2a1")
    File.utime(Time.mktime(2008,1,1),Time.mktime(2008,12,1),@dir+"a2"+@fileseparator+"a2a2"+@fileseparator+"a2a2a2")
    File.utime(Time.mktime(2008,1,1),Time.mktime(2008,12,1),@dir+"a3")
    File.utime(Time.mktime(2008,1,1),Time.mktime(2008,12,1),@dir+"a3"+@fileseparator+"a3a1")
    File.utime(Time.mktime(2008,1,1),Time.mktime(2008,12,1),@dir+"a3"+@fileseparator+"a3a2")
    File.utime(Time.mktime(2008,1,1),Time.mktime(2009,1,1),@dir+"a4")
  end
  
  
end